/*
Disclaimer of Warranty: THE PACKAGE IS PROVIDED
BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS'
AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
THE IMPLIED WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT
ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW.
UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF
THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


(c) Copyright 2013 Edward Principe
All Rights Reserved

*/
#ifndef PARSENODE_H
#define PARSENODE_H

#include <Windows.h>
#include <tchar.h>
#include <string>
#include <syntaxex.h>
#include "parse.h"

using namespace std;

/////////////////////////////////////////////////////////////
// ParseNode: A word parsed
/////////////////////////////////////////////////////////////
class ParseNode
{
public: // Construction
	ParseNode()
	{
		Init();
	}

	ParseNode(const ParseNode& rhs)
	{
		Init();
		Copy(rhs);
	}

public: // Attributes
	bool is_begin; // True if at beginning of buffer
	bool is_end; // True if at the end of the buffer

	wstring word; // A word parsed
	SyntaxErr err; // Error code
	bool is_string; // True, if a string

public: // Operators
	ParseNode& operator = (const ParseNode& rhs)
	{
		Copy(rhs);
		return *this;
	}

private: // Methods
	void Init()
	{
		is_begin = is_end = false;
		err = SE_NONE;
		is_string = false;
	}

	void Copy(const ParseNode& rhs)
	{
        // Return if same object
		if (this == &rhs)
			return;

		is_begin = rhs.is_begin;
		is_end = rhs.is_end;

		word = rhs.word;
		err = rhs.err;
		is_string = rhs.is_string;
	}
};
#endif